Computer Architecture..Second Year (Sem.2).Lecture(4) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات
|
|
- Christopher Benjamin Green
- 5 years ago
- Views:
Transcription
1 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات Assembly Level Machine Organization Usage of AND, OR, XOR, NOT AND : X Y X AND Y USE : to chick any bit by change ( to ) or ( to ) EX : AX = FF5 H, BX = FC H AX BX AX AND BX ~~
2 27 - Example: Computer Architecture..Second Year (Sem.2).Lecture(4) 26 MOV AL, 'a' ; AL = b AND AL, b ; AL = b ('A') مدرس المادة : م. سندس العزاوي... قسم / الحاسبات... OR : X Y X OR Y USE : to select any bit and not change its value EX : AX = FF5 H, BX = FC H AX BX AX OR BX Example: MOV AL, 'A' ; AL = b OR AL, b ; AL = b ('a') ~2~
3 XOR Computer Architecture..Second Year (Sem.2).Lecture(4) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات : X Y X XOR Y USE : to exchange bit value ( to ) or ( to ) EX : AX = FF5 H, BX = FC H AX BX AX XOR BX NOT NOT D X NOT X ~3~
4 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات XCHG instruction XCHG XCHG XCHG reg., reg reg, [add [add.], reg EX: write an 886 assembly language program to exchange two byte number stored in memory location started at 3 with two byte number stored in memory location started at 4. Answer: Mov AX, [3] XCHG AX, [4] Mov [3], AX Q) Execute this four steps using XCHG instruction.. Load 2cdh into BX 2.copy the lower 8-bit from BX to AH 3. Load b to address memory contain in the BX reg. 4. Replace the data between BH and CL ~4~
5 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات Program Flow Control Controlling the program flow is a very important thing, this is where your program can make decisions according to certain conditions. Unconditional Jumps The basic instruction that transfers control to another point in the program is JMP. The basic syntax of JMP instruction: JMP label To declare a label in your program, just type its name and add ":" to the end, label can be any character combination but it cannot start with a number, for example here are 3 legal label definitions: label: label2: a: Label can be declared on a separate line or before any other instruction, for example: x: MOV AX, x2: MOV AX, 2 ~5~
6 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات Here is an example of JMP instruction: ORG h MOV AX, 5 ; set AX to 5. MOV BX, 2 ; set BX to 2. JMP calc back: JMP stop ; go to 'calc'. ; go to 'stop'. calc: ADD AX, BX ; add BX to AX. JMP back ; go 'back'. stop: END ; return to operating system. ; directive to stop the compiler. Short Conditional Jumps Unlike JMP instruction that does an unconditional jump, there are instructions that do a conditional jumps (jump only when some conditions are in act). These instructions are divided in three groups, first group just test single flag, second compares numbers as signed, and third compares numbers as unsigned. Jump instructions that test single flag Instruction Description Condition Opposite Instruction JZ, JE Jump if Zero (Equal). ZF = JNZ, JNE JC, JB, JNAE Jump if Carry (Below, Not Above Equal). CF = JNC, JNB, JAE JS Jump if Sign. SF = JNS ~6~
7 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات... JO Jump if Overflow. OF = JNO JPE, JP Jump if Parity Even. PF = JPO JNZ, JNE Jump if Not Zero (Not Equal). ZF = JZ, JE JNC, JNB, JAE Jump if Not Carry (Not Below, Above Equal). CF = JC, JB, JNAE JNS Jump if Not Sign. SF = JS JNO Jump if Not Overflow. OF = JO JPO, JNP Jump if Parity Odd (No Parity). PF = JPE, JP Jump instructions for signed numbers Instruction Description Condition Opposite Instruction JE, JZ Jump if Equal (=). Jump if Zero. ZF = JNE, JNZ JNE, JNZ Jump if Not Equal (<>). Jump if Not Zero. ZF = JE, JZ JG, JNLE Jump if Greater (>). Jump if Not Less or Equal (not <=). ZF = and SF = OF JNG, JLE JL, JNGE Jump if Less (<). Jump if Not Greater or Equal (not >=). SF <> OF JNL, JGE JGE, JNL Jump if Greater or Equal (>=). Jump if Not Less (not <). SF = OF JNGE, JL JLE, JNG Jump if Less or Equal (<=). Jump if Not Greater (not >). ZF = or SF <> OF JNLE, JG <> - sign means not equal. ~7~
8 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات Jump instructions for unsigned numbers Instruction Description Condition Opposite Instruction JE, JZ Jump if Equal (=). Jump if Zero. ZF = JNE, JNZ JNE, JNZ Jump if Not Equal (<>). Jump if Not Zero. ZF = JE, JZ JA, JNBE Jump if Above (>). Jump if Not Below or Equal (not <=). CF = and ZF = JNA, JBE JB, JNAE, JC Jump if Below (<). Jump if Not Above or Equal (not >=). Jump if Carry. CF = JNB, JAE, JNC JAE, JNB, JNC Jump if Above or Equal (>=). Jump if Not Below (not <). Jump if Not Carry. CF = JNAE, JB JBE, JNA Jump if Below or Equal (<=). Jump if Not Above (not >). CF = or ZF = JNBE, JA Generally, when it is required to compare numeric values CMPinstruction is used (it does the same as SUB (subtract) instruction, but does not keep the result, just affects the flags). The logic is very simple, for example: it's required to compare 5 and 2, 5-2 = 3 the result is not zero (Zero Flag is set to ). Another example: it's required to compare 7 and 7, 7-7 = the result is zero! (Zero Flag is set to and JZ or JE will do ~8~
9 27 - the jump). Computer Architecture..Second Year (Sem.2).Lecture(4) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات Here is an example of CMP instruction and conditional jump: include emu886.inc ORG h MOV AL, 25 ; set AL to 25. MOV BL, ; set BL to. CMP AL, BL ; compare AL - BL. JE equal ; jump if AL = BL (ZF = ). PUTC 'N' JMP stop equal: PUTC 'Y' ; if it gets here, then AL <> BL, ; so print 'N', and jump to stop. ; if gets here, ; then AL = BL, so print 'Y'. stop: ; gets here no matter what. END example: include emu886.inc ORG h MOV AL, 25 ; set AL to 25. MOV BL, ; set BL to. CMP AL, BL ; compare AL - BL. JNE not_equal ; jump if AL <> BL (ZF = ). JMP equal not_equal: ; let's assume that here we ; have a code that is assembled ; to more then 27 bytes... ~9~
10 مدرس المادة : م. سندس العزاوي... قسم / الحاسبات PUTC 'N' JMP stop equal: PUTC 'Y' ; if it gets here, then AL <> BL, ; so print 'N', and jump to stop. ; if gets here, ; then AL = BL, so print 'Y'. stop: ; gets here no matter what. END example: ORG h ; unconditional jump forward: ; skip over next 2 bytes, JMP $2 a DB 3 ; byte. b DB 4 ; byte. ; JCC jump back 7 bytes: ; (JMP takes 2 bytes itself) MOV BL,9 DEC BL ; 2 bytes. CMP BL, ; 3 bytes. JNE $-7 END ~~
BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ
LAB4 RELATED INSTRUCTIONS: Compare, division and jump instructions CMP REG, memory memory, REG REG, REG memory, immediate REG, immediate operand1 - operand2 Result is not stored anywhere, flags are set
More informationEXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
EXPERIMENT WRITE UP AIM: Assembly language program to search a number in given array. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 5 Jump, Conditional Jump, Looping, Compare instructions Labels and jumping (the jmp instruction) mov eax, 1 add eax, eax jmp label1 xor eax, eax label1: sub eax, 303
More informationLABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS
LABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS 1. Object of laboratory The x86 microprocessor family has a large variety of instructions that allow instruction flow control. We have 4 categories: jump,
More informationJump instructions. Unconditional jumps Direct jump. do not change flags. jmp label
do not change flags Unconditional jumps Direct jump jmp label Jump instructions jmp Continue xor eax,eax Continue: xor ecx,ecx Machine code: 0040340A EB 02 0040340C 33 C0 0040340E 33 C9 displacement =
More informationEx: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.
INSTRUCTOR: ABDULMUTTALIB A H ALDOURI Conditional Jump Cond Unsigned Signed = JE : Jump Equal JE : Jump Equal ZF = 1 JZ : Jump Zero JZ : Jump Zero ZF = 1 JNZ : Jump Not Zero JNZ : Jump Not Zero ZF = 0
More informationSelection and Iteration. Chapter 7 S. Dandamudi
Selection and Iteration Chapter 7 S. Dandamudi Outline Unconditional jump Compare instruction Conditional jumps Single flags Unsigned comparisons Signed comparisons Loop instructions Implementing high-level
More informationIFE: Course in Low Level Programing. Lecture 6
IFE: Course in Low Level Programing Lecture 6 Instruction Set of Intel x86 Microprocessors Conditional jumps Jcc jump on condition cc, JMP jump always, CALL call a procedure, RET return from procedure,
More information8086 INSTRUCTION SET
8086 INSTRUCTION SET Complete 8086 instruction set Quick reference: AAA AAD AAM AAS ADC ADD AND CALL CBW CLC CLD CLI CMC CMP CMPSB CMPSW CWD DAA DAS DEC DIV HLT IDIV IMUL IN INC INT INTO I JA JAE JB JBE
More informationLab 6: Conditional Processing
COE 205 Lab Manual Lab 6: Conditional Processing Page 56 Lab 6: Conditional Processing Contents 6.1. Unconditional Jump 6.2. The Compare Instruction 6.3. Conditional Jump Instructions 6.4. Finding the
More informationConditional Processing
١ Conditional Processing Computer Organization & Assembly Language Programming Dr Adnan Gutub aagutub at uqu.edu.sa Presentation Outline [Adapted from slides of Dr. Kip Irvine: Assembly Language for Intel-Based
More informationIntel Instruction Set (gas)
Intel Instruction Set (gas) These slides provide the gas format for a subset of the Intel processor instruction set, including: Operation Mnemonic Name of Operation Syntax Operation Examples Effect on
More informationmith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut dthiebaut@smith.edu 2 Videos to Watch at a Later Time https://www.youtube.com/watch?v=fdmzngwchdk https://www.youtube.com/watch?v=k2iz1qsx4cm
More informationTUTORIAL. Emulador Emu8086 do. Microprocessador 8086
1 TUTORIAL Emulador Emu8086 do Microprocessador 8086 2 8086 Assembler Tutorial for Beginners (Part 1) This tutorial is intended for those who are not familiar with assembler at all, or have a very distant
More informationWeek /8086 Microprocessor Programming
Week 5 8088/8086 Microprocessor Programming Multiplication and Division Multiplication Multiplicant Operand Result (MUL or IMUL) (Multiplier) Byte * Byte AL Register or memory Word * Word AX Register or
More informationChapter 6 (Part a) Conditional Processing
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2025: Assembly Language Discussion Chapter 6 (Part a) Conditional Processing Eng. Eman R. Habib April, 2014 2 Assembly
More informationAssembly Language Lab # 6
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Assembly Language Lab # 6 Boolean Instructions and Conditional Structured Eng. Doaa Abu Jabal Objective: Assembly
More informationLecture (08) x86 programming 7
Lecture (08) x86 programming 7 By: Dr. Ahmed ElShafee 1 Conditional jump: Conditional jumps are executed only if the specified conditions are true. Usually the condition specified by a conditional jump
More informationBasic Assembly Instructions
Basic Assembly Instructions Ned Nedialkov McMaster University Canada SE 3F03 January 2013 Outline Multiplication Division FLAGS register Branch Instructions If statements Loop instructions 2/21 Multiplication
More informationBranching and Looping
Branching and Looping EECE416 uc Fall 2011 Unconditional Jumps jmp Like a goto in a high-level language Format: jmp StatementLabel The next statement executed will be the one at StatementLabel: jmp Encoding
More informationBranching and Looping
X86 Assembly Language Programming: Branching and Looping EECE416 uc Charles Kim Howard University Fall 2013 www.mwftr.com Unconditional Jump: JMP jmp Like a goto in a high-level language Format: jmp StatementLabel
More informationIt is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.
1 od 5 17. 12. 2017 23:53 (https://github.com/schweigi/assembler-simulator) Introduction This simulator provides a simplified assembler syntax (based on NASM (http://www.nasm.us)) and is simulating a x86
More informationCMSC 313 Lecture 05 [draft]
CMSC 313 Lecture 05 [draft] More on Conditional Jump Instructions Short Jumps vs Near Jumps Using Jump Instructions Logical (bit manipulation) Instructions AND, OR, NOT, SHL, SHR, SAL, SAR, ROL, ROR, RCL,
More informationLecture 5 Program Logic and Control
Lecture 5 Program Logic and Control Chapter Outline Short, near and far address JMP Instruction The CMP Instruction Conditional Jump instruction The Loop instruction While Loop REPEAT Loop Short,near,and
More informationComputer Systems C S Cynthia Lee
Computer Systems C S 1 0 7 Cynthia Lee 2 Today s Topics LECTURE: More assembly code! NEXT TIME: More control flow Some misc. instructions you might see in your assign5 binary bomb Details of function call
More informationAPPENDIX C INSTRUCTION SET DESCRIPTIONS
APPENDIX C INSTRUCTION SET DESCRIPTIONS This appendix provides reference information for the 80C186 Modular Core family instruction set. Tables C-1 through C-3 define the variables used in Table C-4, which
More informationCHAPTER SEVENTEEN Assemblers versus Compilers. Intel 80x86 Assembly Language
CHAPTER SEVENTEEN Intel 80x86 Assembly Language In Chapter 15, we developed a generic assembly language and its associated machine code. This language was presented to create a few simple programs and
More informationECE 498 Linux Assembly Language Lecture 3
ECE 498 Linux Assembly Language Lecture 3 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 20 November 2012 Statically Linked C Hello-World Disassembly of section.text : 08048320
More informationBranching and Looping
Branching and Looping Ray Seyfarth August 10, 2011 Branching and looping So far we have only written straight line code Conditional moves helped spice things up In addition conditional moves kept the pipeline
More informationControl. Young W. Lim Mon. Young W. Lim Control Mon 1 / 16
Control Young W. Lim 2016-11-21 Mon Young W. Lim Control 2016-11-21 Mon 1 / 16 Outline 1 Introduction References Condition Code Accessing the Conditon Codes Jump Instructions Translating Conditional Branches
More information7 LOW-LEVEL CONTROL STRUCTURES
7 LOW-LEVEL CONTROL STRUCTURES This chapter discusses pure assembly language control statements. You ll need to master these low-level control structures before you can claim to be an assembly language
More information2.1 Chapter Overview. 2.2 Low Level Control Structures. 2.3 Statement Labels. Low-Level Control Structures
Low Level Control Structures Low-Level Control Structures Chapter Two 2.1 Chapter Overview This chapter discusses pure assembly language control statements. The last section of this chapter discusses hybrid
More informationCS-202 Microprocessor and Assembly Language
CS-202 Microprocessor and Assembly Language Lecture 2 Introduction to 8086 Assembly Language Dr Hashim Ali Spring - 2019 Department of Computer Science and Engineering HITEC University Taxila!1 Lecture
More informationAssembly Language LAB
Assembly Language LAB Islamic University Gaza Engineering Faculty Department of Computer Engineering 2013 ECOM 2125: Assembly Language LAB Created by: Eng. Ahmed M. Ayash Modified and Presented By: Eihab
More informationJones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION 80x86 Instructions
80x86 Instructions Chapter 4 In the following sections, we review some basic instructions used by the 80x86 architecture. This Jones is by & no Bartlett means a Learning, complete list LLC of the Intel
More informationmith College Computer Science CSC231 Assembly Week #10 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #10 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu 2 Videos to Start With https://www.youtube.com/watch?v=fdmzngwchdk https://www.youtube.com/watch?v=k2iz1qsx4cm
More informationfrom WRITE GREAT CODE Volume 2: Thinking Low-Level, Writing High-Level ONLINE APPENDIX A The Minimal 80x86 Instruction Set by Randall Hyde
from WRITE GREAT CODE Volume 2: Thinking Low-Level, Writing High-Level ONLINE APPENDIX A The Minimal 80x86 Set by Randall Hyde San Francisco WRITE GREAT CODE, Volume 2. Copyright 2006 by Randall Hyde.
More informationAssembly Language Tutorial
Assembly Language Tutorial Introduction What's new in the Assembler material After of one year that we've released the first Assembler material on-line. We've received a lot of e- mail where each people
More informationUNIT II 16 BIT MICROPROCESSOR INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING. The Intel 8086 Instruction Set
UNIT II 16 BIT MICROPROCESSOR INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING The Intel 8086 Instruction Set 1.Explain Addressing Modes of 8086? ADDRESSING MODES Implied - the data value/data address
More informationUS06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 3: Assembly Language Instructions II
Unconditional & Conditional JUMP instructions: Conditional JUMP instructions: JA/JNBE Jump if above / Jump if not Below or Equal These two mnemonics represent the same instruction. The term above and below
More informationEC 333 Microprocessor and Interfacing Techniques (3+1)
EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One
More informationIntel x86 Jump Instructions. Part 5. JMP address. Operations: Program Flow Control. Operations: Program Flow Control.
Part 5 Intel x86 Jump Instructions Control Logic Fly over code Operations: Program Flow Control Operations: Program Flow Control Unlike high-level languages, processors don't have fancy expressions or
More informationAssembly Language for Intel-Based Computers, 4 th Edition. Chapter 6: Conditional Processing
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 6: Conditional Processing (c) Pearson Education, 2002. All rights reserved. Chapter Overview Boolean and Comparison Instructions
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More informationIntel x86 Jump Instructions. Part 5. JMP address. Operations: Program Flow Control. Operations: Program Flow Control.
Part 5 Intel x86 Jump Instructions Control Logic Fly over code Operations: Program Flow Control Operations: Program Flow Control Unlike high-level languages, processors don't have fancy expressions or
More informationChapter Four Instructions Set
Chapter Four Instructions set Instructions set 8086 has 117 instructions, these instructions divided into 6 groups: 1. Data transfer instructions 2. Arithmetic instructions 3. Logic instructions 4. Shift
More informationAssembler lecture 5 S.Šimoňák, DCI FEEI TU of Košice
Assembler lecture 5 S.Šimoňák, DCI FEEI TU of Košice Jumps and iterations conditional and unconditional jumps iterations (loop) implementation of HLL control structures Unconditional jump unconditional
More informationx64 Cheat Sheet Fall 2014
CS 33 Intro Computer Systems Doeppner x64 Cheat Sheet Fall 2014 1 x64 Registers x64 assembly code uses sixteen 64-bit registers. Additionally, the lower bytes of some of these registers may be accessed
More informationAm186 and Am188 Family Instruction Set Manual. February, 1997
Am186 and Am188 Family Instruction Set Manual February, 1997 1997 Advanced Micro Devices, Inc. Advanced Micro Devices reserves the right to make changes in its products without notice in order to improve
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST 2 Date : 02/04/2018 Max Marks: 40 Subject & Code : Microprocessor (15CS44) Section : IV A and B Name of faculty: Deepti.C Time : 8:30 am-10:00 am Note: Note: Answer any five complete
More informationSummer 2003 Lecture 4 06/14/03
Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General
More informationSection 002. Read this before starting!
Points missed: Student's Name: _ Total score: /100 points East Tennessee State University -- Department of Computer and Information Sciences CSCI 2150 Computer Organization Final Exam for Fall Semester,
More informationLecture 8: Control Structures. Comparing Values. Flags Set by CMP. Example. What can we compare? CMP Examples
Lecture 8: Control Structures CMP Instruction Conditional High Level Logic Structures Comparing Values The CMP instruction performs a comparison between two numbers using an implied subtraction. This means
More informationSelected Pentium Instructions. Chapter 12 S. Dandamudi
Selected Pentium Instructions Chapter 12 S. Dandamudi Outline Status flags Zero flag Carry flag Overflow flag Sign flag Auxiliary flag Parity flag Arithmetic instructions Multiplication instructions Division
More informationChapter 12. Selected Pentium Instructions
Chapter 12 Selected Pentium Instructions 1 2 Chapter 12 12 1 Carry flag indicates out-of-range error for unsigned operations. Chapter 12 3 12 2 Overflow flag indicates out-of-range error for signed operations.
More informationCSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs
CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)
More informationCS356 Unit 5. Translation to Assembly. Translating HLL to Assembly ASSEMBLY TRANSLATION EXAMPLE. x86 Control Flow
5.1 5.2 CS356 Unit 5 x86 Control Flow Compiler output ASSEMBLY TRANSLATION EXAMPLE Translation to Assembly 5.3 Translating HLL to Assembly 5.4 We will now see some C code and its assembly translation A
More informationSection 001. Read this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 3 for Fall Semester,
More informationAssembly Language II: Addressing Modes & Control Flow
Assembly Language II: Addressing Modes & Control Flow Learning Objectives Interpret different modes of addressing in x86 assembly Move data seamlessly between registers and memory Map data structures in
More informationmith College Computer Science CSC231 Assembly Week #11 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #11 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Back to Conditional Jumps Review sub eax, 10 jz there xxx xxx there:yyy yyy Review cmp eax, 10 jz
More informationCSC 8400: Computer Systems. Machine-Level Representation of Programs
CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages
More informationProgram controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.
2 Microprocessor Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions. It is used as CPU (Central Processing Unit) in computers. 3 Microprocessor
More informationAssembly Language for Intel-Based Computers, 5 th Edition. Kip R. Irvine. Chapter 6: Conditional Processing
Assembly Language for Intel-Based Computers, 5 th Edition Kip R. Irvine Chapter 6: Conditional Processing Chapter Overview Boolean and Comparison Instructions Conditional Jumps Conditional Loop Instructions
More informationCOMP211 ASSEMBLY PROGRAMMING
COMP211 ASSEMBLY PROGRAMMING Chapter 6: Conditional Processing Cristina G. Rivera 2 Chapter Overview Boolean and Comparison Instructions Conditional Jumps Conditional Loop Instructions Conditional Structures
More informationIBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.
IBM PC Hardware CPU 8088, 8086 80286 80386 80486 Pentium... ALU (Arithmetic and Logic Unit) Registers CU (Control Unit) IP Memory ROM BIOS I/O RAM OS Programs Video memory BIOS data Interrupt Vectors Memory
More informationMachine Programming 2: Control flow
Machine Programming 2: Control flow CS61, Lecture 4 Prof. Stephen Chong September 13, 2011 Announcements Assignment 1 due today, 11:59pm Hand in at front during break or email it to cs61- staff@seas.harvard.edu
More informationCS61 Section Solutions 3
CS61 Section Solutions 3 (Week of 10/1-10/5) 1. Assembly Operand Specifiers 2. Condition Codes 3. Jumps 4. Control Flow Loops 5. Procedure Calls 1. Assembly Operand Specifiers Q1 Operand Value %eax 0x104
More informationRead this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 3 for Fall Semester,
More informationAn Introduction to x86 ASM
An Introduction to x86 ASM Malware Analysis Seminar Meeting 1 Cody Cutler, Anton Burtsev Registers General purpose EAX, EBX, ECX, EDX ESI, EDI (index registers, but used as general in 32-bit protected
More information5.1. CS356 Unit 5. x86 Control Flow
5.1 CS356 Unit 5 x86 Control Flow 5.2 Compiler output ASSEMBLY TRANSLATION EXAMPLE 5.3 Translation to Assembly We will now see some C code and its assembly translation A few things to remember: Data variables
More informationCredits and Disclaimers
Credits and Disclaimers 1 The examples and discussion in the following slides have been adapted from a variety of sources, including: Chapter 3 of Computer Systems 2 nd Edition by Bryant and O'Hallaron
More informationWe will first study the basic instructions for doing multiplications and divisions
MULTIPLICATION, DIVISION AND NUMERICAL CONVERSIONS We will first study the basic instructions for doing multiplications and divisions We then use these instructions to 1. Convert a string of ASCII digits
More informationUNIT III 8086 Microprocessor. Lecture 1
UNIT III 8086 Microprocessor Lecture 1 Features of 8086 Microprocessor (RGPV 2013) The 8086, announced in 1978, was the first 16-bit microprocessor introduced by Intel Corporation. 1) 8086 has 16-bit ALU;
More informationSection 001. Read this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University -- Department of Computer and Information Sciences CSCI 2150 Computer Organization Final Exam for Spring Semester,
More informationInternational Islamic University Chittagong (IIUC) Department of Electrical and Electronic Engineering (EEE)
International Islamic University Chittagong (IIUC) Department of Electrical and Electronic Engineering (EEE) EEE-3506: Microprocessor and Interfacing Sessional Experiment No. 05: Program control instructions
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 5
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2017 Lecture 5 LAST TIME Began exploring x86-64 instruction set architecture 16 general-purpose registers Also: All registers are 64 bits wide rax-rdx are
More informationLab 3. The Art of Assembly Language (II)
Lab. The Art of Assembly Language (II) Dan Bruce, David Clark and Héctor D. Menéndez Department of Computer Science University College London October 2, 2017 License Creative Commons Share Alike Modified
More informationCredits and Disclaimers
Credits and Disclaimers 1 The examples and discussion in the following slides have been adapted from a variety of sources, including: Chapter 3 of Computer Systems 3 nd Edition by Bryant and O'Hallaron
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College February 9, 2016 Reading Quiz Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College September 25, 2018 Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between programmer
More informationBasic Intel x86 Assembly Language Programming
1 Basic Intel x86 Programming 2 Intel x86 Processor Family Processor Integer Width (bits) Physical Address (bits) Year Features 8086 16 20 1978 16-bit data I/O bus 8088 16 20 1979 8-bit data I/O bus Used
More informationAssembly Language: IA-32 Instructions
Assembly Language: IA-32 Instructions 1 Goals of this Lecture Help you learn how to: Manipulate data of various sizes Leverage more sophisticated addressing modes Use condition codes and jumps to change
More informationThe higher the values of above, the more powerful the CPU. Microprocessors are categorized in additional as: RISC or CISC.
MICROPROCESSOR: A silicon chip that contains a CPU. A microprocessor (sometimes abbreviated μp) is a digital electronic component with miniaturized transistors on a single semiconductor integrated circuit
More informationAssembly Language for Intel-Based Computers, 4 th Edition. Chapter 6: Conditional Processing. Chapter Overview. Boolean and Comparison Instructions
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 6: Conditional Processing Slides prepared by Kip R. Irvine Revision date: 10/19/2002 Chapter corrections (Web) Assembly language
More information9/25/ Software & Hardware Architecture
8086 Software & Hardware Architecture 1 INTRODUCTION It is a multipurpose programmable clock drive register based integrated electronic device, that reads binary instructions from a storage device called
More informationCS 290 Host-based Security and Malware. Christopher Kruegel
CS 290 Host-based Security and Malware Christopher Kruegel chris@cs.ucsb.edu Reverse Engineering Introduction Reverse engineering process of analyzing a system understand its structure and functionality
More informationEx : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.
Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H. MOV AX, 5000H MOV DS, AX MOV AL, 20H MOV CL, 30H ADD AL, CL MOV CL, 10H MUL CL
More informationSection 001 & 002. Read this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 3 for Spring Semester,
More informationSOEN228, Winter Revision 1.2 Date: October 25,
SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND Segment The "SEGMENT" and "ENDS" directives indicate to the assembler the beginning and ending of a segment and have the following format label SEGMENT [options] ;place the statements belonging
More informationAssembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice
Assembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice Addressing data access specification arrays - specification and manipulation impacts of addressing to performance Processor architecture CISC (more
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 8 Bit Operations Clock cycle & instruction timing http://www.newagepublishers.com/samplechapter/000495.pdf Clock cycle & instruction timing See 8086: http://www.oocities.org/mc_introtocomputers/instruction_timing.pdf
More informationSungkyunkwan University
- 2 - Complete addressing mode, address computation (leal) Arithmetic operations Control: Condition codes Conditional branches While loops - 3 - Most General Form D(Rb,Ri,S) Mem[ Reg[ R b ] + S Reg[ R
More informationArithmetic Instructions
Segment 3C Arithmetic Instructions This topic covers the following instructions: Addition (ADD, INC, ADC) Subtraction (SUB, DEC, SBB,CMP) Multiplication (MUL, IMUL) Division (DIV, IDIV) BCD Arithmetic
More informationComputer Architecture and Assembly Language Programming CS401 Lecture No: 1 Address, Data, and Control Buses A computer system comprises of a
Computer Architecture and Assembly Language Programming CS401 Lecture No: 1 Address, Data, and Control Buses A computer system comprises of a processor, memory, and I/O devices. I/O is used for interfacing
More information1 if (a == b) 2 { 3 /* true stuff here */ 4 } 5 else 6 { 7 /* false stuff here */ 8 } 10 /* done either way (i.e., whether true.
1 movl a, %eax 2 movl b, %ebx 3 cmpl %eax, %ebx 4 je truestuff 5 6 /* false stuff here */ 7 jmp DoneEitherWay 8 9 truestuff: 10 /* if true code here */ 1 int absdiff(int x, int y) 3 if (x
More informationPRACTICAL WORKBOOK. Department of Computer Engineering University of Lahore. Designed and Compiled by : Engineer Zahid Muneer. Batch.
PRACTICAL WORKBOOK Computer Architecture and Organization Name : Year : Batch : Roll No : Department of Computer Engineering University of Lahore Designed and Compiled by : Engineer Zahid Muneer 1 Contents
More informationWhere We Are. Optimizations. Assembly code. generation. Lexical, Syntax, and Semantic Analysis IR Generation. Low-level IR code.
Where We Are Source code if (b == 0) a = b; Low-level IR code Optimized Low-level IR code Assembly code cmp $0,%rcx cmovz %rax,%rdx Lexical, Syntax, and Semantic Analysis IR Generation Optimizations Assembly
More informationLAB 3: Programming in Assembly Language
INTERNATIONAL ISLAMIC UNIVERSITY OF MALAYSIA Kulliyyah Of Engineering Department Of Electrical Engineering ELECTRICAL AND COMPUTER ENGINEERING LAB II (ECE 2202) Name: Matric Number: Group: Section: Date:
More information